
<template>
  <div class="all">
    <header>
      <div @click="back()">
        <img src="../../assets/fff返回.png" alt="">
        <span class="sides" >返回</span>
      </div>
      <div>
<!--        <span>个人建档码</span>-->
      </div>
      <div>
        <span></span>
      </div>
    </header>
    <div class="content">
      <div class="box">
        <div class="title">
          <li style="position: relative">
            <img :src="logoSrc" alt="">
<!--            <img v-else src="../../assets/photo.png" alt="">-->
            <div class="sex">
              <img src="../../assets/男.png" v-show="peopleList.sex == 1" alt="">
              <img src="../../assets/女.png" v-show="peopleList.sex == 2" alt="">
            </div>
          </li>
          <li>
            <p>
              {{peopleList.name}}
            </p>
            <p>
              {{peopleList.phone}}
            </p>
          </li>
        </div>
        <p class="title_text">形成联系</p>
        <div class="erweima">
          <vue-qr :logo-src="logoSrc"
                  :size="191"
                  :margin="0"
                  :auto-color="true"
                  :dot-scale="1"
                  :logoScale=".2"
                  :text="appSrc" />
        </div>
        <p class="bottom">
          扫一扫二维码，新建档案
        </p>
      </div>
    </div>
  </div>
</template>

<script>
import VueQr from 'vue-qr'
import $ from 'jquery'
import HTTP from '../../http/video.http'
export default {
  name: 'DoctorQRcode',
  components: {
    VueQr
  },
  data () {
    return {
      logoSrc: '',
      appSrc: '',
      userid: '',
      peopleList: [],
      qianzui: HTTP.Http
    }
  },
  mounted () {
    // 从网址上截取 userid 后面的值
    this.userid = this.$utils.getUrlKey('userid')
    this.getPerson()
    this.appSrc = this.qianzui + 'vue_kfhl/#/profiles?userid=' + this.userid + '&isAdd=1'
    console.log(this.appSrc)
    var height = $(window).height() - $('header').height() - 50 + 'px'
    $('.content').css('height', height)
  },
  methods: {
    // 我的档案进入 获取个人基本信息
    getPerson () {
      this.$http.findUserXinXiTuoMin({'data_user_id': this.userid})
        .then(res => {
          console.log(res)
          if (res.data.status === 'success') {
            if (res.data.data.PHOTO !== undefined) {
              this.logoSrc = res.data.data.PHOTO
            } else {
              this.logoSrc = require('../../assets/photo.png')
            }
            this.peopleList = res.data.data
          }
        })
        .catch(err => {
          console.log(err)
        })
    },
    // 返回
    back () {
      window.history.go(-1)
    }
  }
}
</script>

<style scoped>
  li{
    list-style: none;
  }
  header{
    height: 12vw;
    color: white;
    background: linear-gradient(90deg, #1DA3F2, #1DC7F2);
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  header div {
    width: 33%;
    display: flex;
    align-items: center;
  }
  header div:nth-child(2) {
    justify-content: center;
  }
  header img{
    width: 7px;
    height: 13px;
    margin-left: 15px;
    margin-right: 5px;
  }
  header span{
    font-size: 15px;
    font-family: PingFang SC;
    font-weight: bold;
  }
  .sides{
  }
  .content{
    width: 100%;
    background-image: url("../../assets/homeBackground.png");
    background-repeat: no-repeat;
    background-size: 100% 30%;
    background-position: top;
    /*padding-top: 70px;*/
    /*display: flex;*/
    /*justify-content: center;*/
    /*box-sizing: border-box;*/
  }
  .content .box{
    width: 90%;
    height: 460px;
    background: #FFFFFF;
    box-shadow: 0px 2px 30px 0px rgba(0, 0, 0, 0.05);
    border-radius: 10px;
  }
  .erweima{
    width: 250px;
    height: 250px;
    background: #FFFFFF;
    border: 1px solid #1DA7F2;
    border-radius: 10px;
    /*margin: 0 auto;*/
    margin: 10px auto;
  }
  .title{
    width: 100%;
    padding: 10px;
    box-sizing: border-box;
    display: flex;
  }
  .sex{
    position: absolute;
    bottom: 0px;
    right: 0px;
    z-index: 999;
  }
  .sex img{
    width: 15px !important;
    height: 15px !important;
  }
  .title li{
    display: flex;
    /*align-items: center;*/
    justify-content: center;
    flex-direction: column;
  }
  .title li:nth-child(1) {
    margin-right: 15px;
  }
  .title li:nth-child(2) {
    width: 70%;
  }
  .title p{
    font-size: 15px;
    font-family: PingFang SC;
    font-weight: bold;
    color: #333333;
  }
  .title p:nth-child(1){
    margin-bottom: 5px;
  }
  .title img{
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 50%;
  }
  .title_text{
    height: 44px;
    font-size: 16px;
    font-family: PingFang SC;
    font-weight: 600;
    color: #1DA4F2;
  }
  .bottom{
    height: 44px;
    font-size: 15px;
    font-family: PingFang SC;
    font-weight: 500;
    color: #333333;
    padding: 0 10px;
    box-sizing: border-box;
  }
  .content,
  .erweima,
  .title_text,
  .bottom{
    display: flex;
    align-items: center;
    justify-content: center;
  }
</style>
